<template>
  <div>
    <el-container>
      <el-header>黑马学习系统</el-header>
      <el-container style="height: 5px; border: 1px solid #eee"></el-container>
      <el-container>
        <el-aside width="200px" style="height: 800px; border: 1px solid #eee">
          <el-menu :default-openeds="['1', '3']">
            <el-submenu index="1">
              <template slot="title"
                ><i class="el-icon-message"></i>系统信息管理
              </template>
              <el-menu-item-group>
                <router-link to="/dept">
                  <el-menu-item index="1-1">部门管理</el-menu-item>
                </router-link>
                <router-link to="/emp">
                  <el-menu-item index="1-2">员工管理</el-menu-item>
                </router-link>
              </el-menu-item-group>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main>
          <el-form :inline="true" :model="formInline" class="demo-form-inline">
            <el-form-item label="姓名">
              <el-input
                v-model="formInline.user"
                placeholder="请输入姓名"
              ></el-input>
            </el-form-item>
            <el-form-item label="性别">
              <el-select v-model="formInline.region" placeholder="请选择性别">
                <el-option label="男" value="nan"></el-option>
                <el-option label="女" value="nv"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item>
              <div class="block">
                <span class="demonstration">入职时间</span>
                <el-date-picker
                  v-model="value1"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                >
                </el-date-picker>
              </div>
            </el-form-item>
            <el-form-item>
              <el-button type="primary" @click="onSubmit">查询</el-button>
            </el-form-item>
          </el-form>

          <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="name" label="姓名" width="180">
            </el-table-column>
            <el-table-column prop="image" label="图像" width="180">
              <template slot-scope="scope">
                <img :src="scope.row.image" height="50px" width="50px" />
              </template>
            </el-table-column>
            <el-table-column prop="gender" label="性别" width="180">
              <template slot-scope="scope">
                {{ scope.row.gender == 1 ? "男" : "女" }}
              </template>
            </el-table-column>
            <el-table-column prop="job" label="职位" width="180">
            </el-table-column>
            <el-table-column prop="entrydate" label="入职日期" width="180">
            </el-table-column>
            <el-table-column prop="updatetime" label="最后操作日期" width="180">
            </el-table-column>
            <el-table-column label="操作">
              <el-button type="primary" size="mini">编辑</el-button>
              <el-button type="danger" size="mini">删除</el-button>
            </el-table-column>
          </el-table>
          <div>
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="currentPage4"
              :page-sizes="[100, 200, 300, 400]"
              :page-size="100"
              layout="total, sizes, prev, pager, next, jumper"
              :total="400"
            >
            </el-pagination>
          </div>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      tableData: [],
      formInline: {
        user: "",
        region: "",
      },
      value1: "",
    };
  },
  methods: {
    onSubmit() {
      console.log("submit!");
    },
  },
  mounted() {
    axios
      .get("https://mock.apifox.cn/m1/3128855-0-default/emp/list")
      .then((result) => {
        this.tableData = result.data.data;
      });
  },
};
</script>

<style>
.el-header {
  background-color: #b3c0d1;
  color: #333;
  text-align: center;
  line-height: 60px;
  font-size: 50px;
}
.el-aside {
  background-color: white;
  color: #333;
  text-align: center;
  line-height: 100px;
}
</style>